package com.travelzen._15.generic;

import java.util.*;

import com.scofevil.util.Generator;

public class Generators {
	public static <T> Collection<T> fill(Collection<T> coll, Generator<T> gen, int n) {
		for (int i = 0; i < n; i++)
			coll.add(gen.next());
		return coll;
	}

	public static void main(String[] args) {
		Collection<Coffee> coffee = fill(new ArrayList<Coffee>(), new CoffeeGenerator(), 4);
		for (Coffee coffee2 : coffee) {
			System.out.println(coffee2);
		}
		Collection<Integer> fnumbers = fill(new ArrayList<Integer>(),new Fibonacci(),12);
		for (Integer integer : fnumbers) {
			System.out.println(integer + ",");
		}
	}
}
